﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using DocumentFormat.OpenXml.Wordprocessing;

using ProjectBase.Core;

namespace $safeprojectname$.Export.Word
{
    public class ValueTypeHandler : DocPartHandlerBase
    {
        /// <summary> 300, the second default handler</summary>
        public override int Priority { get { return 300; } }

        protected override HandlerResult HandleDocPart(DocPart currentPart, IPersistentObject entity, params string[] prefixes)
        {
            var name = currentPart.Name(prefixes);

            // ValueType property
            ValueType val;
            if (entity.TryGetResult(name, out val))
            {
                currentPart.InjectValue(val.ToDisplay());
                return HandlerResult.Finished;
            }

            return HandlerResult.Continue;
        }
    }
}